<template>
  <div class="big">
    <div class="box">
      <img :src="imgUrl" alt="" />
      <p :style="{ backgroundColor: colorStr }" @click="bianseFn">
        {{ dogname }}
      </p>
    </div>
  </div>
</template>

<script>
export default {
  props: ["imgUrl", "dogname","index"],
  data() {
    return {
      colorStr: "",
    };
  },
  methods: {
    bianseFn() {
      this.colorStr = `rgb(${Math.floor(Math.random() * 256)},${Math.floor(
        Math.random() * 256)},${Math.floor(Math.random() * 256)})`;

        this.$emit("like",this.index)
    },
  
  },
};
</script>

<style>
* {
  margin: 0;
}
.big {
  width: 780px;
}
.box {
  width: 260px;
  text-align: center;
  border: 1px solid #000;
  /* display: inline-block; */
  float: left;
}
.box img {
  width: 100%;
  height: 220px;
}
</style>